<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/axios-0.18.0.js"></script>
</head>
<body>
<button onclick="send()">发送异步请求</button>
<script>
    function send() {
        //1. get
        /*axios({
            method: "get",
            url: "http://localhost:8080/Filter_Listener/axiosServlet?username=zhangsan"
        }).then(function (response) {
            alert(response.data);
        });*/
        /*-----------------------------------------------------------------------------*/
        //请求方法别名
        /*axios.get("http://localhost:8080/Filter_Listener/axiosServlet?username=zhangsan")
            .then(function (response) {
                alert(response.data);
            });*/

        //2. post
        /*axios({
            method: "post",
            url: "http://localhost:8080/Filter_Listener/axiosServlet"
            data: "username=zhangsan"
        }).then(function (response) {
            alert(response.data);
        });*/
        /*-----------------------------------------------------------------------------*/
        //请求方法别名
        axios.post("http://localhost:8080/Filter_Listener/axiosServlet","username=zhangsan")
            .then(function (response) {
                alert(response.data);
            });
    }
</script>
</body>

</html>